class WoodRenderer : public IBlockRenderer
{
public:
	ITexture *Texture;

	WoodRenderer(ITexture *texture) :
		Texture(texture)
	{
	}

	int GetTypeData(const int &data) { return data & 0x03; }

	static Point2i BarkTextureForDir(RendererBase *renderer, const byte &d)
	{
		switch (d)
		{
			default:
			case 0:
				return Point2i(4 * 16, 1 * 16);
			case 1:
				return Point2i(4 * 16, 7 * 16);
			case 2:
				return Point2i(5 * 16, 7 * 16);
			case 3:
				return Point2i(9 * 16, 9 * 16);
		}
	}

	void Render(Schematic *schematic, RendererBase *renderer, const Block &block, const Point3i &position)
	{
		renderer->Translate(8, 8, 8);
		
		if ((block.Data & 0x4) != 0)
			renderer->Rotate(90, 0, 0, 1);
		if ((block.Data & 0x8) != 0)
			renderer->Rotate(90, 1, 0, 0);

		renderer->Translate(-8, -8, -8);

		renderer->Draw(Box(Texture).SetAll(BarkTextureForDir(renderer, block.Data & 0x03)).SetTop(Point2i(5 * 16, 1 * 16)).SetBottom(Point2i(5 * 16, 1 * 16)));
	}
};